package com.igeek.d0618.test5;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Scanner;

/**
 * @Author: zhiyu
 * @Date:18:08
 * @DESC:
 */
public class TestA {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入类名:");
        String input = scanner.nextLine();
        Class<?> aClass = Class.forName(input);
        Object o = aClass.newInstance();
        Method[] methods = aClass.getMethods();
        methods[0].invoke(o,"调用showString()");
    }
}
